from selenium.webdriver.common.by import By


class PageLogin:#这里接受传入的浏览器对象
    def __init__(self, driver):
        self.driver = driver

    def login(self, username, password):
        self.driver.find_element(By.ID, 'username').send_keys(username )
        self.driver.find_element(By.ID, 'password').send_keys(password)
        self.driver.find_element(By.ID, 'login_btn').click()

    def get_login_success_result(self):
        result = self.driver.find_element(By.XPATH, '//*[@id="logo"]/a').text
        return result
